package com.cloudbroker.openapi.manage.controller;

import static com.cloudbroker.bcs.platform.dav.common.util.RequestUtil.getSingleParameterMapForBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cloudbroker.bcs.common.entity.HSBCPSBackVO;
import com.cloudbroker.bcs.common.util.VOUtil;
import com.cloudbroker.bcs.platform.dav.bizapi.service.base.vo.HSBCPSVO;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.customer.vo.BrokerTenantIdForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.customer.vo.SuggestionAddForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.reward.vo.BrokerIdForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.system.back.BrokerManagerInfoForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.system.back.BrokerManagerList;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.system.back.BrokerPermissionList;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.system.back.ConfigurableSystemSetInfoResult;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.system.back.FansInvitationCodeResult;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.system.back.HomePageTitleResult;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.system.back.ItnAccesstokenForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.system.back.PaymentOptionInfoForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.system.vo.BrokerAuthSaveForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.system.vo.BrokerManagerIdForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.system.vo.BrokerManagerSaveForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.system.vo.FansInvitationCodeForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.system.vo.HomePageTitleForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.system.vo.PaymentOptionSaveForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.system.vo.ShowPersonNumSetForm;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.business.SystemT2BizService;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.export.ItnT2BizService;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.viewpoint.ViewPointT2BizService;
import com.cloudbroker.bcs.platform.dav.common.ext.annotation.SaveLog;

@Controller
public class SystemController {
    
    @Resource
    private SystemT2BizService systemT2;
    
    @Resource
    private ItnT2BizService itnT2;

    @Resource
    private ViewPointT2BizService viewpointT2;

    
    @ResponseBody
    @RequestMapping("/func_payment_option_save")
    @SaveLog(remark = "设置打赏、充值额度")
    public HSBCPSBackVO funcPaymentOptionSave(HttpServletRequest request, String jsonpcallback) {
        PaymentOptionSaveForm form = getSingleParameterMapForBody(request, PaymentOptionSaveForm.class);
        return VOUtil.setJsonpResult(systemT2.funcPaymentOptionSave(form), jsonpcallback);
    }
    
    @ResponseBody
    @RequestMapping("/func_payment_option_qry")
    @SaveLog(remark = "查询打赏、充值额度")
    public PaymentOptionInfoForm funcPaymentOptionQry(HttpServletRequest request, String jsonpcallback) {
        BrokerIdForm form = getSingleParameterMapForBody(request, BrokerIdForm.class);
        return VOUtil.setJsonpResult(systemT2.funcPaymentOptionQry(form), jsonpcallback);
    }
    
    /**
     * 新增管理员子大V
     * */
    @ResponseBody
    @RequestMapping("/func_broker_manager_save")
    @SaveLog(remark = "新增管理员子大V")
    public HSBCPSBackVO funcBrokerManagerSave(HttpServletRequest request, String jsonpcallback) {
        BrokerManagerSaveForm form = getSingleParameterMapForBody(request, BrokerManagerSaveForm.class);
        return VOUtil.setJsonpResult(systemT2.funcBrokerManagerSave(form), jsonpcallback);
    }
    
    /**
     * 删除管理员子大V
     * */
    @ResponseBody
    @RequestMapping("/func_broker_manager_del")
    @SaveLog(remark = "删除管理员子大V")
    public HSBCPSBackVO funcBrokerManagerDel(HttpServletRequest request, String jsonpcallback) {
        BrokerManagerIdForm form = getSingleParameterMapForBody(request, BrokerManagerIdForm.class);
        return VOUtil.setJsonpResult(systemT2.funcBrokerManagerDel(form), jsonpcallback);
    }
    
    /**
     * 查询管理员子大V信息
     * */
    @ResponseBody
    @RequestMapping("/func_broker_manager_info")
    @SaveLog(remark = "查询管理员子大V信息")
    public BrokerManagerInfoForm funcBrokerManagerInfo(HttpServletRequest request, String jsonpcallback) {
        BrokerManagerIdForm form = getSingleParameterMapForBody(request, BrokerManagerIdForm.class);
        return VOUtil.setJsonpResult(systemT2.funcBrokerManagerInfo(form), jsonpcallback);
    }
    
    /**
     * 查询管理员列表
     * */
    @ResponseBody
    @RequestMapping("/func_broker_manager_list")
    @SaveLog(remark = "查询管理员列表")
    public BrokerManagerList funcBrokerManagerList(HttpServletRequest request, String jsonpcallback) {
        HSBCPSVO form = getSingleParameterMapForBody(request, HSBCPSVO.class);
        return VOUtil.setJsonpResult(systemT2.funcBrokerManagerList(form), jsonpcallback);
    }
    
    /**
     * 获取权限列表
     */
    @ResponseBody
    @RequestMapping("/func_broker_permission_list")
    @SaveLog(remark = "获取权限列表")
    public BrokerPermissionList funcBrokerPermissionList(HttpServletRequest request, String jsonpcallback) {
        HSBCPSVO form = getSingleParameterMapForBody(request, HSBCPSVO.class);
        return VOUtil.setJsonpResult(systemT2.funcBrokerPermissionList(form), jsonpcallback);
    }
    
    /**
     * 设置大V授权帐号
     */
    @ResponseBody
    @RequestMapping("/func_broker_auth_info_set")
    @SaveLog(remark = "设置大V授权帐号")
    public HSBCPSBackVO funcBrokerAuthInfo(HttpServletRequest request, String jsonpcallback) {
        BrokerAuthSaveForm form = getSingleParameterMapForBody(request, BrokerAuthSaveForm.class);
        return VOUtil.setJsonpResult(systemT2.funcBrokerAuthInfo(form), jsonpcallback);
    }
    
    /**
     * 设置fans邀请码
     */
    @ResponseBody
    @RequestMapping("/func_set_invitation_code")
    @SaveLog(remark = "设置fans邀请码")
    public HSBCPSBackVO funcSetInvitationCode(HttpServletRequest request, String jsonpcallback) {
        FansInvitationCodeForm form = getSingleParameterMapForBody(request, FansInvitationCodeForm.class);
        return VOUtil.setJsonpResult(systemT2.funcSetInvitationCode(form), jsonpcallback);
    }
    
    /**
     * 获取fans邀请码
     */
    @ResponseBody
    @RequestMapping("/func_get_invitation_code")
    @SaveLog(remark = "获取fans邀请码")
    public FansInvitationCodeResult funcGetInvitationCode(HttpServletRequest request, String jsonpcallback) {
        HSBCPSVO form = getSingleParameterMapForBody(request, HSBCPSVO.class);
        return VOUtil.setJsonpResult(systemT2.funcGetInvitationCode(form), jsonpcallback);
    }
    
    /**
     * 设置fans网页主标题成功
     */
    @ResponseBody
    @RequestMapping("/func_home_page_title_set")
    @SaveLog(remark = "设置fans网页主标题")
    public HSBCPSBackVO funcHomePageTitleSet(HttpServletRequest request, String jsonpcallback) {
        HomePageTitleForm form = getSingleParameterMapForBody(request, HomePageTitleForm.class);
        return VOUtil.setJsonpResult(systemT2.funcHomePageTitleSet(form), jsonpcallback);
    }
    
    /**
     * 获取fans网页主标题
     */
    @ResponseBody
    @RequestMapping("/func_home_page_title_get")
    @SaveLog(remark = "获取fans网页主标题")
    public HomePageTitleResult funcHomePageTitleGet(HttpServletRequest request, String jsonpcallback) {
        HSBCPSVO form = getSingleParameterMapForBody(request, HSBCPSVO.class);
        return VOUtil.setJsonpResult(systemT2.funcHomePageTitleGet(form), jsonpcallback);
    }
    
    /**
     * 设置在线人数开关和阈值
     */
    @ResponseBody
    @RequestMapping("/func_show_person_num_set")
    @SaveLog(remark = "设置在线人数开关和阈值")
    public HSBCPSBackVO funcShowPersonNumSet(HttpServletRequest request, String jsonpcallback) {
        ShowPersonNumSetForm form = getSingleParameterMapForBody(request, ShowPersonNumSetForm.class);
        return VOUtil.setJsonpResult(systemT2.funcShowPersonNumSet(form), jsonpcallback);
    }
    
    /**
     * 大V端系统设置信息获取
     * 微信分享、主题方案、在线显示、打赏配置、前段主页标题
     * */
    
    @ResponseBody
    @RequestMapping("/func_system_set_info_get")
    @SaveLog(remark = "大V端系统设置信息获取")
    public ConfigurableSystemSetInfoResult funcSystemSetInfoGet(HttpServletRequest request, String jsonpcallback) {
        HSBCPSVO form = getSingleParameterMapForBody(request, HSBCPSVO.class);
        return VOUtil.setJsonpResult(systemT2.funcSystemSetInfoGet(form), jsonpcallback);
    }

    /**
     * 运营管理端系统主题方案获取
     * @param request
     * @param jsonpcallback
     * @return
     */
    @ResponseBody
    @RequestMapping("/func_system_get_skin_info")
    @SaveLog(remark = "运营管理端系统设置信息获取")
    public ConfigurableSystemSetInfoResult funcSystemGetSkinInfo(HttpServletRequest request, String jsonpcallback) {
        BrokerTenantIdForm form = getSingleParameterMapForBody(request, BrokerTenantIdForm.class);
        return VOUtil.setJsonpResult(systemT2.funcSystemGetSkinInfo(form), jsonpcallback);
    }


    @ResponseBody
    @RequestMapping("/func_refresh_accesstoken")
    @SaveLog(remark = "手动更新accesstoken")
    public HSBCPSBackVO funcRefreshAccessToken(HttpServletRequest request, String jsonpcallback) {
        HSBCPSVO form = getSingleParameterMapForBody(request, HSBCPSVO.class);
        return VOUtil.setJsonpResult(systemT2.funcRefreshAccessToken(form), jsonpcallback);
    }
    
    @ResponseBody
    @RequestMapping("/func_add_opinion")
    @SaveLog(remark = "大V端系统设置意见反馈")
    public HSBCPSBackVO funcAddOpinion(HttpServletRequest request, String jsonpcallback) {
        SuggestionAddForm form = getSingleParameterMapForBody(request, SuggestionAddForm.class);
        return VOUtil.setJsonpResult(systemT2.funcAddOpinion(form), jsonpcallback);
    }


    @ResponseBody
    @RequestMapping("/func_itn_access_token")
    @SaveLog(remark = "获取itn_access_token")
    public ItnAccesstokenForm funcGetAccessTokenHeaders(HttpServletRequest request, String jsonpcallback) {
        HSBCPSVO form = getSingleParameterMapForBody(request, HSBCPSVO.class);
        return VOUtil.setJsonpResult(itnT2.funcGetItnAccessToken(form), jsonpcallback);
    }
}
